angular.module('GiveStock')

.factory('GiveStockHomeService', ['$q', 'Http',
    function($q, Http) {
       //获取备货看板数据 
       function getGiveStockData (userId) {
            var defer = $q.defer();

            Http.post({
                url: "/api/Kanban/GetUpStreamKanban",
                data: {
                    Parameter: {
                        userId: userId
                    }
                }
            }).then(function (data) {
                defer.resolve(data);   
            }, function (err) {
                defer.reject(err);
            });

            return defer.promise;
        }
        //获取交接区数据
        function getConnectArea (terminalId) {
            var defer = $q.defer();

            Http.post({
                url: "/api/Kanban/queryConnectAreaByTerminal",
                data: {
                    Parameter: {
                        uniqueID: terminalId,
                        isUp:true
                    }
                }
            }).then(function (data) {
                defer.resolve(data); 
            }, function (err) {
                defer.reject(err);
            });

            return defer.promise;
        }

        return{
            getGiveStockData:getGiveStockData,
            getConnectArea:getConnectArea
        };
     
    }
]);
